package com.cos.common;

import org.springframework.beans.factory.FactoryBean;

import java.sql.Connection;
import java.sql.DriverManager;

/**
 * @author: COS
 * @time: 2021/11/11 14:13
 * @description:
 */
public class MyConnectionFactory implements FactoryBean {
    @Override
    public Object getObject() throws Exception {
        Class.forName("com.mysql.jdbc.Driver");
        Connection cos = DriverManager.getConnection("jdbc:mysql://localhost:3306/qf2108", "cos", "123456");
        return cos;
    }

    @Override
    public Class<?> getObjectType() {
        return Connection.class;
    }
}
